home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / stdarg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-17  |  1.0 KB  |  42 lines  |  [TEXT/MPS ]

  1. /*
  2.     StdArg.h -- Variable arguments
  3.     
  4.     Copyright Apple Computer,Inc.    1987, 1990, 1994, 1995
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9.  
  10. #ifndef __STDARG__
  11. #define __STDARG__
  12.  
  13. /*
  14.  * Get common declarations 
  15.  */
  16.  
  17. #include <NullDef.h>
  18. #include <SizeTDef.h>
  19. #include <VaListTDef.h>
  20.  
  21. #if __spillargs
  22.     /*    "__spillargs" needed for PowerMac register-based calling conventions.  */
  23.     /*    When using other preprocessors other than MrC, simply define "__spillargs".  */
  24.     #undef __spillargs
  25.     extern int __spillargs;
  26.     #define va_start(ap, parmN) ap = (__spillargs, (va_list)((unsigned int)&(parmN) + (((sizeof(parmN)+3)/4)*4)))
  27.  
  28. #elif !defined (__SC__) || defined (__CFM68K__) || defined(__MRC__)
  29.     /*    most normal compilers are long-word aligned…  */
  30.     #define va_start(ap, parmN) ap = (va_list)((unsigned int)&(parmN) + (((sizeof(parmN)+3)/4)*4))
  31.  
  32. #else
  33.     /*    …but Symantec C is word aligned.  */
  34.     #define va_start(ap, parmN) ap = (va_list)((char*)&parmN + (((sizeof(parmN)+1)/2)*2))
  35. #endif
  36.  
  37. #define va_arg(ap, type) ((type *)(ap += sizeof (type)))[-1]
  38. #define va_end(ap)    /* do nothing */
  39.  
  40.  
  41. #endif
  42.